# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from ..MessageAnalysis import*

class JT_8300:
    result = []
    str=""
    def LogicAisle(self, protocolStr, header):
        print "header8300=%s"%header[1].split(':')[1]
        count = 0
        str=protocolStr[count:count + 2]
        str=bin(int(str,16))
        str=str[2:]
        str=str.zfill(8)
        huaq=""
        huaq=str[-1:]
        header.append("标志:" + str )
        if huaq=="1":
            header.append("紧急"+"\n")
        huaq=str[-3:-2]
        if huaq=="1":
            header.append("终端显示器显示"+"\n")
        huaq = str[-4:-3]
        if huaq == "1":
            header.append("终端TTS播读" + "\n")
        huaq = str[-5:-4]
        if huaq == "1":
            header.append("广告屏显示" + "\n")
        huaq = str[-6:-5]
        if huaq == "1":
            header.append("CAN故障码信息" + "\n")
        else:
            header.append("中心导航信息"+"\n")
            str=protocolStr[2:-4]
            str=str.decode("hex").decode('gb2312')
            print (str)
            header.append("文本信息:"+ str )
        self.result = header
